package com.ys.config;

import org.quartz.impl.JobDetailImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;

/**
 * <p>@description:</p>
 *
 * @projectName: spring-boot-schedule
 * @packageName: com.ys.config
 * @className:
 * @author: shuangyang
 * @date: 17-8-15 下午10:48
 */
@Configuration
public class BeanConfig {

    @Autowired
    SpringJobFactory jobFactory;

    /**
     * 注册调度器
     *
     * @return
     */
    @Bean
    public SchedulerFactoryBean createSchedulerFactoryBean() {
        SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
        schedulerFactoryBean.setJobFactory(jobFactory);
        return schedulerFactoryBean;
    }

    @Bean
    public JobDetailImpl createJobDetailImpl() {
        return new JobDetailImpl();
    }
}
